% Remember to use the lgrind style

\Head{}
\File{./java/Console.java}{2006}{4}{27}{19:09}{1407}
\L{\LB{\C{}//:_com:bruceeckel:swing:Console.java\CE{}}}
\L{\LB{\C{}//_Tool_for_running_Swing_demos_from_the\CE{}}}
\L{\LB{\C{}//_console,_both_applets_and_JFrames.\CE{}}}
\L{\LB{\C{}//_From_{'}Thinking_in_Java,_3rd_ed.{'}_(c)_Bruce_Eckel_2002\CE{}}}
\L{\LB{\C{}//_www.BruceEckel.com._See_copyright_notice_in_CopyRight.txt.\CE{}}}
\L{\LB{\K{package}_\V{com}.\V{bruceeckel}.\V{swing};}}
\L{\LB{\K{import}_\V{javax}.\V{swing}.*;}}
\L{\LB{\K{import}_\V{java}.\V{awt}.\V{event}.*;}}
\L{\LB{}}
\L{\LB{\K{public}_\K{class}_\V{Console}_\{}}
\L{\LB{}\Tab{2}{\C{}//_Create_a_title_string_from_the_class_name:\CE{}}}
\index{title}\Proc{title}\L{\LB{}\Tab{2}{\K{public}_\K{static}_\V{String}_\V{title}(\V{Object}_\V{o})_\{}}
\L{\LB{}\Tab{4}{\V{String}_\V{t}_=_\V{o}.\V{getClass}().\V{toString}();}}
\L{\LB{}\Tab{4}{\C{}//_Remove_the_word_\3class\3:\CE{}}}
\L{\LB{}\Tab{4}{\K{if}(\V{t}.\V{indexOf}(\S{}\3class\3\SE{})_!=_\-\N{1})}}
\L{\LB{}\Tab{6}{\V{t}_=_\V{t}.\V{substring}(\N{6});}}
\L{\LB{}\Tab{4}{\K{return}_\V{t};}}
\L{\LB{}\Tab{2}{\}}}
\L{\LB{}\Tab{2}{\K{public}_\K{static}_\K{void}}}
\index{run}\Proc{run}\L{\LB{}\Tab{2}{\V{run}(\V{JFrame}_\V{frame},_\K{int}_\V{width},_\K{int}_\V{height})_\{}}
\L{\LB{}\Tab{4}{\V{frame}.\V{setDefaultCloseOperation}(\V{JFrame}.\V{EXIT\_ON\_CLOSE});}}
\L{\LB{}\Tab{4}{\V{frame}.\V{setSize}(\V{width},_\V{height});}}
\L{\LB{}\Tab{4}{\V{frame}.\V{setVisible}(\K{true});}}
\L{\LB{}\Tab{2}{\}}}
\L{\LB{}\Tab{2}{\K{public}_\K{static}_\K{void}}}
\index{run}\Proc{run}\L{\LB{}\Tab{2}{\V{run}(\V{JApplet}_\V{applet},_\K{int}_\V{width},_\K{int}_\V{height})_\{}}
\L{\LB{}\Tab{4}{\V{JFrame}_\V{frame}_=_\K{new}_\V{JFrame}(\V{title}(\V{applet}));}}
\L{\LB{}\Tab{4}{\V{frame}.\V{setDefaultCloseOperation}(\V{JFrame}.\V{EXIT\_ON\_CLOSE});}}
\L{\LB{}\Tab{4}{\V{frame}.\V{getContentPane}().\V{add}(\V{applet});}}
\L{\LB{}\Tab{4}{\V{frame}.\V{setSize}(\V{width},_\V{height});}}
\L{\LB{}\Tab{4}{\V{applet}.\V{init}();}}
\L{\LB{}\Tab{4}{\V{applet}.\V{start}();}}
\L{\LB{}\Tab{4}{\V{frame}.\V{setVisible}(\K{true});}}
\L{\LB{}\Tab{4}{\C{}//System.out.println(frame.getSize());\CE{}}}
\L{\LB{}\Tab{2}{\}}}
\L{\LB{}\Tab{2}{\K{public}_\K{static}_\K{void}}}
\index{run}\Proc{run}\L{\LB{}\Tab{2}{\V{run}(\V{JPanel}_\V{panel},_\K{int}_\V{width},_\K{int}_\V{height})_\{}}
\L{\LB{}\Tab{4}{\V{JFrame}_\V{frame}_=_\K{new}_\V{JFrame}(\V{title}(\V{panel}));}}
\L{\LB{}\Tab{4}{\V{frame}.\V{setDefaultCloseOperation}(\V{JFrame}.\V{EXIT\_ON\_CLOSE});}}
\L{\LB{}\Tab{4}{\V{frame}.\V{getContentPane}().\V{add}(\V{panel});}}
\L{\LB{}\Tab{4}{\V{frame}.\V{setSize}(\V{width},_\V{height});}}
\L{\LB{}\Tab{4}{\V{frame}.\V{setVisible}(\K{true});}}
\L{\LB{}\Tab{2}{\}}}
\L{\LB{\}_\C{}///:\~{}\CE{}}}
